//
//  DYZFavouriteTableViewCell.m
//  wind
//
//  Created by dllo on 16/1/12.
//  Copyright © 2016年 李金明. All rights reserved.
//

#import "DYZFavouriteTableViewCell.h"

@interface DYZFavouriteTableViewCell ()

@property (nonatomic, retain) UIView *picV;
@property (nonatomic, retain) UIImageView *imageV;
@property (nonatomic, retain) UILabel *title;
@property (nonatomic, retain) UILabel *subTitle;

@end

@implementation DYZFavouriteTableViewCell

- (void)dealloc
{
    [_imageV release];
    [_title release];
    [_subTitle release];
    [_picV release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createViews];
    }
    return self;
}

- (void)createViews
{
//    self.backgroundColor = [UIColor yellowColor];
    
    self.picV = [[UIView alloc] init];
    self.picV.backgroundColor = [UIColor colorWithRed:0.365 green:0.848 blue:1.000 alpha:1.000];
    [self addSubview:self.picV];
    [_picV release];
    
    self.imageV = [[UIImageView alloc] init];
//    self.imageV.backgroundColor = [UIColor colorWithRed:1.000 green:0.193 blue:0.186 alpha:1.000];
    [self.imageV setImage:[UIImage imageNamed:@"iconfont-iconxin"]];
    [self.picV addSubview:self.imageV];
    [_imageV release];
    
    self.title = [[UILabel alloc] init];
    self.title.text = @"我收藏的音乐";
    self.title.font = [UIFont boldSystemFontOfSize:18];
    [self addSubview:self.title];
    [_title release];
    
    self.subTitle = [[UILabel alloc] init];
//    self.subTitle.backgroundColor = [UIColor blueColor];
    self.subTitle.text = @"0首";
    [self addSubview:self.subTitle];
    [_subTitle release];
    
    [self.picV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.equalTo(self);
        make.left.mas_equalTo(@12);
        make.width.equalTo(self.picV.mas_height);
        make.top.mas_equalTo(@5);
        make.bottom.mas_equalTo(@-5);
        
    }];
    
    [self.imageV mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.center.equalTo(self.picV);
        make.width.equalTo(@40);
        make.height.equalTo(@40);
        
    }];
    
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    [self.title mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.picV.mas_right).with.offset(20);
        make.top.mas_equalTo(@5);
        make.width.mas_equalTo(@160);
        make.height.equalTo(self.subTitle);
        
    }];
    
    [self.subTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.title);
        make.top.equalTo(self.title.mas_bottom).with.offset(5);
        make.bottom.mas_equalTo(@-5);
        make.width.equalTo(self.title);
        
    }];

}

@end
